package com.ocean.web.controller.product;

import com.ocean.common.core.domain.AjaxResult;
import com.ocean.common.core.page.TableDataInfo;
import com.ocean.productDict.domain.OAging;
import com.ocean.productDict.domain.oNcfileMonitor;
import com.ocean.productDict.service.oNcfileMonitorService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * nc文件统计
 */
@Controller
@RequestMapping("/product/nctj")
public class nctJController {
    @Autowired
    private oNcfileMonitorService oNcfileMonitorService;

    private String prefix = "system/nctj";
    @GetMapping()
    public String aging()
    {
        return prefix + "/scanboard";
    }

    /**
     * 查询总数
     * @return
     */
    @PostMapping("/allnum")
    @ResponseBody
    public AjaxResult allnum()
    {
        Long allnum = oNcfileMonitorService.getnumall();
        return AjaxResult.success(allnum);
    }

    /**
     * 根据条件查询数量
     * @param type
     * @return
     */
    @PostMapping("/getnum")
    @ResponseBody
    public AjaxResult getnum(@RequestParam(value = "time", required = false) boolean time)
    {
        Map<String, String> getnum = oNcfileMonitorService.getnum(time);
        return AjaxResult.success(getnum);
    }

    /**
     * 判断日期是否上传文件
     * @param time
     * @return
     */
    @PostMapping("/getYandN")
    @ResponseBody
    public AjaxResult getYandN(String kstime,String jstime)
    {
        Map yandN = oNcfileMonitorService.getYandN(kstime, jstime);//国家级
        return AjaxResult.success(yandN);
    }
    /**
     * 获取当天上传文件
     * @return
     */
    @PostMapping("/tabledata")
    @ResponseBody
    public AjaxResult tabledata()
    {
        List<oNcfileMonitor> tabledata = oNcfileMonitorService.gettabledata();
        return AjaxResult.success(tabledata);
    }

    /**
     * 月文件统计数量
     * @return
     */
    @PostMapping("/ywjtjsl")
    @ResponseBody
    public AjaxResult ywjtjsl(String kstime,String jstime)
    {
        Map tabledata = oNcfileMonitorService.ywjtjsl(kstime,jstime);
        return AjaxResult.success(tabledata);
    }
}
